<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

Route::get('/adminpage', function(){
    return view('admin/login');
});

Route::get('test',function(){
    $a = \App\Services\Wechat\WechatLogin::getTicketByAccessToken();
    echo $a->getTicket();
});

Route::get('api/wechat/pay', ['as' => 'Api.General.pay', 'uses' => 'HomeController@pay']);

Route::group(['middleware' => ['web']], function () {

    Route::get('/',['as'=>'M.Home','uses'=>'HomeController@index']);

    Route::group(['prefix' => 'm'],function() {

        Route::get('home', ['as'=>'M.Home.index','uses'=>'HomeController@index']);
        Route::get('bespeak/{id}',['as'=>'M.Home.bespeak','uses'=>'HomeController@bespeak']);
        /** 套餐 2016.12.10 */
        Route::get('packages',['as'=>'M.Home.packages','uses'=>'HomeController@packages']);
        /** 套餐详情 2016.12.10 */
        Route::get('package-detail/{id}',['as'=>'M.Home.packageDetail','uses'=>'HomeController@packageDetail']);
        /** 科室列表 */
        Route::get('keshi-list',['as'=>'M.Home.keshiList','uses'=>'HomeController@keshiList']);
        /** 用户中心 */
        Route::get('usercenter',['as'=>'M.Home.userCenter','uses'=>'HomeController@userCenter']);
        Route::get('doctor-list',['as'=>'M.Home.doctorList','uses'=>'HomeController@doctorList']);
        Route::get('new-doctor-list',['as'=>'M.Home.newDoctorList','uses'=>'HomeController@newDoctorList']);
        Route::get('new-doctor-detail/{id}',['as'=>'M.Home.newDoctorDetail','uses'=>'HomeController@newDoctorDetail']);
        Route::get('order-list',['as'=>'M.Home.orderList','uses'=>'HomeController@orderList']);
        Route::get('content-detail', ['as' => 'M.Home.contentDetail', 'uses' => 'HomeController@contentDetail']);
        Route::get('new-ask-doctor/{id}', ['as' => 'M.Home.askDoctor', 'uses' => 'HomeController@askDoctor']);
        Route::get('new-doctor-mianzhen', ['as' => 'M.Home.newMianzhen', 'uses' => 'HomeController@newMianzhen']);
        Route::get('new-doctor-appoint', ['as' => 'M.Home.newAppoint', 'uses' => 'HomeController@newAppoint']);
        Route::get('new-usercenter', ['as' => 'M.Home.newUserCenter', 'uses' => 'HomeController@newUserCenter']);
        Route::get('new-usercenter-set', ['as' => 'M.Home.newUserCenterSet', 'uses' => 'HomeController@newUserCenterSet']);
        Route::get('new-face-time', ['as' => 'M.Home.newFaceTime', 'uses' => 'HomeController@newFaceTime']);
        Route::get('new-appoint-time', ['as' => 'M.Home.newAppointTime', 'uses' => 'HomeController@newAppointTime']);
        Route::get('new-follow-doctors', ['as' => 'M.Home.newFollowDoctors', 'uses' => 'HomeController@newFollowDoctors']);
        Route::get('new-my-questions', ['as'=>'M.Home.newMyQuestions', 'uses'=>'HomeController@newMyQuestions']);
        Route::get('new-show-answer', ['as'=>'M.Home.newShowAnswer', 'uses'=>'HomeController@newShowAnswer']);
        Route::get('referral-pay', ['as'=>'M.Home.referralPay', 'uses'=>'HomeController@referralPay']);

        Route::group(['prefix'=>'doctor'],function(){
            Route::get('user-center',['as'=>'M.Doctor.userCenter','uses'=>'DoctorController@userCenter']);
            Route::get('user-center-set',['as'=>'M.Doctor.userCenterSet','uses'=>'DoctorController@userCenterSet']);
            Route::get('set-appointment',['as'=>'M.Doctor.setAppolitment','uses'=>'DoctorController@setAppolitment']);
            Route::get('set-face',['as'=>'M.Doctor.setFace','uses'=>'DoctorController@setFace']);
            Route::get('my-questions',['as'=>'M.Doctor.myQuestions','uses'=>'DoctorController@myQuestions']);
            Route::get('answer-questions',['as'=>'M.Doctor.answerQuestion','uses'=>'DoctorController@answerQuestion']);
            Route::get('my-answer',['as'=>'M.Doctor.myAnswer','uses'=>'DoctorController@myAnswer']);
            Route::get('my-qrcode',['as'=>'M.Doctor.myQrcode','uses'=>'DoctorController@myQrcode']);
            Route::get('order-list',['as'=>'M.Doctor.orderList','uses'=>'DoctorController@orderList']);
            Route::get('my-patients',['as'=>'M.Doctor.myPatients','uses'=>'DoctorController@myPatients']);
            Route::get('referral',['as'=>'M.Doctor.referral','uses'=>'DoctorController@referral']);
            Route::get('hospital-list',['as'=>'M.Doctor.hospitalList','uses'=>'DoctorController@hospitalList']);
            Route::get('confirm-referral',['as'=>'M.Doctor.confirmReferral','uses'=>'DoctorController@confirmReferral']);
            Route::get('patient-list',['as'=>'M.Doctor.patientList','uses'=>'DoctorController@patientList']);
        });
    });

    Route::group(['prefix'=>'admin'],function(){
        Route::get('login',['as'=>'Admin.Index.login','uses'=>'AdminController@login']);
        Route::get('login-out',['as'=>'Admin.Index.signOut','uses'=>'AdminController@signOut']);
        Route::get('user-list',['as'=>'Admin.Index.userList','uses'=>'AdminController@userList']);
        Route::get('doctor-add',['as'=>'Admin.Index.doctorAdd','uses'=>'AdminController@doctorAdd']);
        Route::get('doctor-hug',['as'=>'Admin.Index.doctorHug','uses'=>'AdminController@doctorHug']);
        Route::get('doctor-list',['as'=>'Admin.Index.doctorList','uses'=>'AdminController@doctorList']);
        Route::get('doctor-detail',['as'=>'Admin.Index.doctorDetail','uses'=>'AdminController@doctorDetail']);
        Route::get('packages-list',['as'=>'Admin.Index.packagesList','uses'=>'AdminController@packagesList']);
        Route::get('packages-add',['as'=>'Admin.Index.packagesAdd','uses'=>'AdminController@packagesAdd']);
        Route::get('create-content',['as'=>'Admin.Index.createContent','uses'=>'AdminController@createContent']);
        Route::get('create-good',['as'=>'Admin.Index.createGood','uses'=>'AdminController@createGood']);
        Route::get('phone-msg',['as'=>'Admin.Index.phoneMsg','uses'=>'AdminController@phoneMsg']);
        Route::get('order-list',['as'=>'Admin.Index.orderList','uses'=>'AdminController@orderList']);
        Route::get('keshi-list',['as'=>'Admin.Index.keshiList','uses'=>'AdminController@keshiList']);
        Route::get('change-pwd',['as'=>'Admin.Index.changePwd','uses'=>'AdminController@changePwd']);
        Route::get('hospital-list',['as'=>'Admin.Index.hospitalList','uses'=>'AdminController@hospitalList']);
        Route::get('hospital-add',['as'=>'Admin.Index.hospitalAdd','uses'=>'AdminController@hospitalAdd']);
        Route::get('referral-list',['as'=>'Admin.Index.referralList','uses'=>'AdminController@referralList']);
    });

    Route::group(['prefix'=>'manager'],function(){
        Route::get('index',['as'=>'Manager.Index.mainPage','uses'=>'ManagerController@mainPage']);
        Route::get('phone-list',['as'=>'Manager.Index.phoneList','uses'=>'ManagerController@phoneList']);
    });

    //后台路由
    Route::group(['prefix'=>'backstage','namespace'=>'Backstage','middleware' => ['cors']],function(){
        //后台登录接口
        Route::post('signInUser',['as'=>'Backstage.Admin.signInUser','uses'=>'AdminController@signInUser']);
        //医生登录接口
        Route::post('signInDoctor',['as'=>'Backstage.Admin.signInDoctor','uses'=>'AdminController@signInDoctor']);
        //修改密码
        Route::post('changePassword',['as'=>'Backstage.Admin.changePassword','uses'=>'AdminController@changePassword']);
        //退出登录接口
        Route::post('loginOut',['as'=>'Backstage.Admin.loginOut','uses'=>'AdminController@loginOut']);
        //登陆信息
        Route::get('getAdminUserInfo',['as'=>'Backstage.Admin.getAdminUserInfo','uses'=>'AdminController@getAdminUserInfo']);


        Route::get('getActivityList',['as' => 'Backstage.Activity.inlist', 'uses' => 'ActivityController@inlist']);
        Route::get('getActivityDetail',['as' => 'Backstage.Activity.Detail', 'uses' => 'ActivityController@details']);
        Route::post('getActivityUpdate',['as' => 'Backstage.Activity.update', 'uses' => 'ActivityController@update']);
        Route::post('getActivityInsert',['as' => 'Backstage.Activity.insert', 'uses' => 'ActivityController@insert']);
        Route::post('getActivityDelete',['as' => 'Backstage.Activity.delete', 'uses' => 'ActivityController@delete']);
        Route::post('activityUpdateStatus',['as' => 'Backstage.Activity.activityUpdateStatus', 'uses' => 'ActivityController@activityUpdateStatus']);

        Route::get('getActivitySignuplist',['as' => 'Backstage.Activity.signuplist', 'uses' => 'ActivityController@signuplist']);
        Route::get('getActivitySignupDetail',['as' => 'Backstage.Activity.signupDetails', 'uses' => 'ActivityController@signupDetails']);


        Route::get('ceshiQrCode',['as' => 'Backstage.Activity.ceshiQrCode', 'uses' => 'ActivityController@ceshiQrCode']);

    });

    Route::group(['prefix'=>'api', 'namespace'=>'Api','middleware' => ['cors']],function() {
        /** 获取系统token */
        Route::get('get-csrf-token', ['as' => 'Api.General.GetCsrfToken', 'uses' => 'GeneralController@getCsrfToken']);
        /** 获取系统时间 */
        Route::get('get-sys-time', ['as' => 'Api.General.getSystemTime', 'uses' => 'GeneralController@getSystemTime']);
        /** 提交套餐预约接口 */
        Route::post('submint-package-bespoke', ['as' => 'Api.YiLiao.submitPackageBespoke', 'uses' => 'YiLiaoController@submitPackageBespoke']);
        /** 提交医生预约接口 */
        Route::post('submint-doctor-bespoke', ['as' => 'Api.YiLiao.submitDoctorBespoke', 'uses' => 'YiLiaoController@submitDoctorBespoke']);

        /** 图片上传和显示接口 */
        Route::group(['prefix' => 'auth'],function(){
            /** 引导用户到微信的登录授权页面 */
            Route::get('weixin-login', ['as'=>'Api.Auth.weixinLogin', 'uses'=>'AuthController@weixinLogin']);
            Route::get('weixin-callback', ['as'=>'Api.Auth.weixinCallback', 'uses'=>'AuthController@weixinCallback']);
            Route::post('signin-by-admin', ['as'=>'Api.Auth.signInByAdmin', 'uses'=>'AuthController@signInByAdmin']);
        });

        Route::group(['prefix' => 'user'],function(){
            /** 引导用户到微信的登录授权页面 */
            Route::post('set-userinfo', ['as'=>'Api.User.setUserInfo', 'uses'=>'UserController@setUserInfo']);
            Route::post('add-doctor', ['as'=>'Api.User.addDoctor', 'uses'=>'UserController@addDoctor']);
            Route::post('follow-doctor', ['as'=>'Api.User.followDoctor', 'uses'=>'UserController@followDoctor']);
            Route::post('add-question', ['as'=>'Api.User.addQuestion', 'uses'=>'UserController@addQuestion']);
            Route::get('follow-doctor-qrcode', ['as'=>'Api.User.followDocByQrcode', 'uses'=>'UserController@followDocByQrcode']);

        });

        Route::group(['prefix'=>'doctor'],function(){
            Route::post('set-userinfo',['as'=>'Api.Doctor.setUserInfo','uses'=>'DoctorController@setUserInfo']);
            Route::post('set-work-time',['as'=>'Api.Doctor.setWorkTime','uses'=>'DoctorController@setWorkTime']);
            Route::post('set-work-limit',['as'=>'Api.Doctor.setWorkLimit','uses'=>'DoctorController@setWorkLimit']);
            Route::post('answer-question',['as'=>'Api.Doctor.answerQuestion','uses'=>'DoctorController@answerQuestion']);
            Route::post('check-info',['as'=>'Api.Doctor.checkDoctor','uses'=>'DoctorController@checkDoctor']);
            Route::get('doc-qrcode',['as'=>'Api.Doctor.docQrcode','uses'=>'DoctorController@docQrcode']);
            Route::get('getDepartmentByHospitalId',['as'=>'Api.Doctor.getDepartmentByHospitalId','uses'=>'DoctorController@getDepartmentByHospitalId']);
            Route::get('getDoctorByDepId',['as'=>'Api.Doctor.getDoctorByDepId','uses'=>'DoctorController@getDoctorByDepId']);
            Route::post('buildReferral',['as'=>'Api.Doctor.buildReferral','uses'=>'DoctorController@buildReferral']);
            Route::get('sendMsg',['as'=>'Api.Doctor.sendMsg','uses'=>'DoctorController@sendMsg']);
            Route::post('confirmReferral',['as'=>'Api.Doctor.confirmReferral','uses'=>'DoctorController@confirmReferral']);
        });

        Route::group(['prefix' => 'wechat'],function(){
            Route::any('index', ['as'=>'Api.Wechat.index', 'uses'=>'WechatController@index']);

            Route::any('wpay', ['as'=>'Api.Wechat.pay', 'uses'=>'WechatController@pay']);

            Route::any('pay-callback', ['as'=>'Api.Wechat.payCallBack', 'uses'=>'WechatController@payCallBack']);

            Route::post('get-js-api-packet', ['as'=>'Api.Wechat.getJsApiPacket', 'uses'=>'WechatController@getJsApiPacket']);
        });

        Route::group(['prefix' => 'activity'], function () {
//            Route::get('classify',['as'=>'Api.Activity.activityClassify','uses'=>'ActivityController@activityClassify']);
//            Route::get('activityClassifyChild',['as'=>'Api.Activity.activityClassifyChild','uses'=>'ActivityController@activityClassifyChild']);
            Route::get('getActivity', ['as' => 'Api.Activity.getActivity', 'uses' => 'ActivityController@getActivity']);
            Route::get('getActivityDetail', ['as' => 'Api.Activity.getActivityDetail', 'uses' => 'ActivityController@getActivityDetail']);
            Route::get('generateShareQrCode', ['as' => 'Api.Activity.generateShareQrCode', 'uses' => 'ActivityController@generateShareQrCode']);
//            Route::post('buildActivity',['as'=>'Api.Activity.buildActivity','uses'=>'ActivityController@buildActivity']);
//            Route::post('delActivity',['as'=>'Api.Activity.delActivity','uses'=>'ActivityController@delActivity']);
//            Route::get('getActivePartyList',['as'=>'Api.Activity.getActivePartyList','uses'=>'ActivityController@getActivePartyList']);
//            Route::get('getActivePartyDetail',['as'=>'Api.Activity.getActivePartyDetail','uses'=>'ActivityController@getActivePartyDetail']);
            Route::post('activityBrowseRecord', ['as' => 'Api.Activity.activityBrowseRecord', 'uses' => 'ActivityController@activityBrowseRecord']);
            Route::post('activityCheckIn', ['as' => 'Api.Activity.activityCheckIn', 'uses' => 'ActivityController@activityCheckIn']);
            Route::get('activityCheckStatus', ['as' => 'Api.Activity.activityCheckStatus', 'uses' => 'ActivityController@activityCheckStatus']);
            Route::post('activitySignUpOffline', ['as' => 'Api.Activity.activitySignUpOffline', 'uses' => 'ActivityController@activitySignUpOffline']);

        });


        Route::get('get-doctor-hug/{doctor_data}', ['as' => 'Api.YiLiao.getDoctorHug', 'uses' => 'YiLiaoController@getDoctorHug']);

        Route::get('shang-jia/{id}', ['as' => 'Api.YiLiao.shangJia', 'uses' => 'YiLiaoController@shangJia']);

        Route::get('delete-package/{id}', ['as' => 'Api.YiLiao.deletePackage', 'uses' => 'YiLiaoController@deletePackage']);

        Route::post('add-package', ['as' => 'Api.YiLiao.addPackages', 'uses' => 'YiLiaoController@addPackages']);

        Route::post('set-doctor-hug', ['as' => 'Api.YiLiao.setDoctorHug', 'uses' => 'YiLiaoController@setDoctorHug']);

        Route::get('append-packages/{page}', ['as' => 'Api.YiLiao.appendPackages', 'uses' => 'YiLiaoController@appendPackages']);

        Route::get('append-doctors/{page}', ['as' => 'Api.YiLiao.appendDoctors', 'uses' => 'YiLiaoController@appendDoctors']);


        Route::group(['prefix' => 'order'], function () {
            Route::post('confim-order', ['as' => 'Api.Order.confimOrder', 'uses' => 'YiLiaoController@confimOrder']);
            Route::get('getAllHospital', ['as' => 'Api.Upload.getAllHospital', 'uses' => 'YiLiaoController@getAllHospital']);
            Route::get('getAllDep', ['as' => 'Api.Upload.getAllDep', 'uses' => 'YiLiaoController@getAllDep']);

            //会议报名接口
            Route::post('buildOrder', ['as' => 'Api.Upload.buildActivityOrder', 'uses' => 'YiLiaoController@buildActivityOrder']);

            Route::get('getActivityRegistrationFee', ['as' => 'Api.Upload.getActivityRegistrationFee', 'uses' => 'YiLiaoController@getActivityRegistrationFee']);
            Route::get('getDoctorInfo', ['as' => 'Api.Upload.getDoctorInfo', 'uses' => 'YiLiaoController@getDoctorInfo']);
        });

        Route::get('ucenter/getUserJoinActivity', ['as' => 'Api.User.setPhoneMsg', 'uses' => 'UserController@getUserJoinActivity']);

        //发送验证码
        Route::post('auth/sendVerificationCode',['as'=>'Api.Auth.sendVerificationCode','uses'=>'UserController@sendVerificationCode']);


        Route::group(['prefix' => 'user'], function () {
            Route::post('add-address', ['as' => 'Api.User.addAddress', 'uses' => 'UserController@addAddress']);
            Route::post('del-user-address', ['as' => 'Api.User.delUserAddress', 'uses' => 'UserController@delUserAddress']);
            Route::get('set-user-phone', ['as' => 'Api.User.setPhoneMsg', 'uses' => 'UserController@setPhoneMsg']);
        });

        /** 图片上传和显示接口 */
        Route::group(['prefix' => 'image'], function () {
            /** 输出原图片接口 */
            Route::get('{id}', ['as' => 'Api.Image.Show', 'uses' => 'ImageController@getImageUrlById']);
            /** 输出不同尺寸图片接口 */
            Route::get('{id}/show/{px}', ['as' => 'Api.Image.ShowPX', 'uses' => 'ImageController@getImageBinAsShowById']);
            /** 剪裁图片接口 */
            Route::post('crop-image', ['as' => 'Api.Image.CropImage', 'uses' => 'ImageController@CropImage']);
            /** 多图上传接口 */
            Route::post('upload-images', ['as' => 'Api.Image.uploadImages', 'uses' => 'ImageController@uploadImages']);
        });

        /** 上传图片接口 */
        Route::post('upload/image', ['as' => 'Api.Upload.Image', 'uses' => 'ImageController@upload']);


        Route::group(['prefix' => 'article'], function () {
            Route::post('build-article', ['as' => 'Api.Article.buildArticle', 'uses' => 'ArticleController@buildArticle']);
            Route::post('del-article', ['as' => 'Api.Article.delArticle', 'uses' => 'ArticleController@delArticle']);
        });

        Route::group(['prefix' => 'admin'], function () {
            Route::post('change-pwd', ['as' => 'Api.Auth.changePassword', 'uses' => 'AuthController@changePassword']);
            Route::post('del-doctor', ['as' => 'Api.Admin.delDoctor', 'uses' => 'UserController@delDoctor']);
            Route::post('setHospital', ['as' => 'Api.Admin.setHospital', 'uses' => 'AdminController@setHospital']);
            Route::post('setHospitalDep', ['as' => 'Api.Admin.setHospitalDep', 'uses' => 'AdminController@setHospitalDep']);
            Route::post('delHospital', ['as' => 'Api.Admin.delHospital', 'uses' => 'AdminController@delHospital']);
            Route::post('delHospitalDep', ['as' => 'Api.Admin.delHospitalDep', 'uses' => 'AdminController@delHospitalDep']);
            Route::post('setHospitalSort', ['as' => 'Api.Admin.setHospitalSort', 'uses' => 'AdminController@setHospitalSort']);
        });


    });
});
